//
//  TTCommitFailViewController.m
//  TaoTuo
//
//  Created by admin on 2019/10/10.
//  Copyright © 2019 admin. All rights reserved.
//

#import "TTCommitFailViewController.h"

@interface TTCommitFailViewController ()

@end

@implementation TTCommitFailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"提交订单";
    self.view.backgroundColor = kSeparatorColor;
    self.fd_interactivePopDisabled = YES;
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 80, 80)];
    imageView.contentMode = UIViewContentModeScaleAspectFit;
    imageView.image = [UIImage imageNamed:@"payfail"];
    [self.view addSubview:imageView];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(50);
        make.centerX.equalTo(self.view);
        make.width.height.mas_equalTo(80);
    }];
    
    UILabel *failLabel = [UILabel labelWithTitle:@"提交失败" color:[UIColor blackColor] font:[UIFont fontWithName:@"Source Han Sans CN" size:18]];
    [self.view addSubview:failLabel];
    [failLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imageView.mas_bottom).mas_offset(20);
        make.centerX.equalTo(self.view);
    }];
    
    
    
    UIButton *backHomeBtn = [UIButton createButtonWithTitle:@"返回首页" titleColor:[UIColor whiteColor] titleFontSize:15 borderColor:kMainColor cornerRadius:15 contentEdgeInsets:UIEdgeInsetsMake(6, 9, 6, 9) target:self action:@selector(backHomeBtnClick)];
    backHomeBtn.backgroundColor = kMainColor;
    
    UIButton *contactBtn = [UIButton createButtonWithTitle:@"联系客服" titleColor:kMainColor titleFontSize:15 borderColor:kMainColor cornerRadius:15 contentEdgeInsets:UIEdgeInsetsMake(6, 9, 6, 9) target:self action:@selector(contactBtnClick)];
    
    UIStackView *stView = [[UIStackView alloc] init];
    stView.axis = UILayoutConstraintAxisHorizontal;
    stView.distribution = UIStackViewDistributionFill;
    stView.alignment = UIStackViewAlignmentCenter;
    stView.spacing = 30;
    [self.view addSubview:stView];
    
    [stView addArrangedSubview:backHomeBtn];
    [stView addArrangedSubview:contactBtn];
    
    [stView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(failLabel.mas_bottom).mas_offset(25);
        make.centerX.equalTo(self.view);
        make.height.mas_equalTo(40);
        make.width.mas_equalTo(210);
    }];
    
    [stView layoutIfNeeded];
    backHomeBtn.layer.cornerRadius = backHomeBtn.height * 0.5;
    contactBtn.layer.cornerRadius = contactBtn.height * 0.5;
    
}

- (void)backHomeBtnClick
{
    [LLRouteTool gotoHomeViewController];
}

- (void)contactBtnClick
{
    [[TTLoginSingle sharedSingle].loginModel.SalesmanMobile callPhone];
}


@end
